﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SCRUM.Core.DataProviders;
using SCRUM.Core.BusinessObjects;

namespace SCRUM.Core.DAO
{
    /// <summary>
    /// Data access object User in Role
    /// </summary>
    public static class DAOUserInRole
    {

        /// <summary>
        /// Gets the users who match specified criteria. If any of parameters is -1 than this criterium is ignored
        /// </summary>
        /// <param name="userInRoleID">The user in role ID.</param>
        /// <param name="projectID">The project ID.</param>
        /// <param name="teamID">The team ID.</param>
        /// <returns>collection of user who apply to filter</returns>
        public static IList<UserInRole> GetUsersInRole(int userInRoleID, int projectID, int teamID)
        {
            return ProviderFactory.Provider.GetUsersInRole(userInRoleID, projectID, teamID);
        }

        /// <summary>
        /// Adds the user in role.
        /// </summary>
        /// <param name="userID">The user ID.</param>
        /// <param name="roleID">The role ID.</param>
        /// <param name="teamID">The team ID.</param>
        public static void AddUserInRole(int userID, int roleID, int teamID)
        {
            ProviderFactory.Provider.AddUserInRole(userID, roleID, teamID);
        }

        /// <summary>
        /// Deletes the user in role.
        /// </summary>
        /// <param name="userInRoleID">The user in role ID.</param>
        public static void DeleteUserInRole(int userInRoleID)
        {
            ProviderFactory.Provider.DeleteUserInRole(userInRoleID);
        }

        /// <summary>
        /// Edits the user in role with specified userInRoleID
        /// </summary>
        /// <param name="userInRoleID">The user in role ID.</param>
        /// <param name="userID">new user ID.</param>
        /// <param name="roleID">new role ID.</param>
        /// <param name="teamID">new team ID.</param>
        public static void EditUserInRole(int userInRoleID, int userID, int roleID, int teamID)
        {
            ProviderFactory.Provider.EditUserInRole(userInRoleID, userID, roleID, teamID);
        }
    }
}
